<?php
/**
 * User: hjd-yao
 * Date: 2019/3/29
 * Time: 10:48
 */

namespace App\Helpers\Traits;


trait HandleError
{
    public $errorMsg = false;

    public function getErrorMsg($default='未知错误',$isStr=true)
    {
        if(!$this->errorMsg){
            return $default;
        }
        if(is_array($this->errorMsg)&&$isStr){
            $this->errorMsg = arr2str(array_flatten($this->errorMsg));
        }

        return $this->errorMsg;
    }
}